#ifndef STRING_H_
#define STRING_H_

#include "base.h"

#ifdef __cplusplus
extern "C" {
#endif

#define MAXSTRSIZE	255
typedef  unsigned char SString[MAXSTRSIZE];

Status CreateSString( SString *T, const char *pstr, size_t length );
BOOL ConcatSString( SString *T, SString S1, SString S2 );
BOOL CmpSString( SString *S1, SString *S2 );
Status SubString( SString *substr, SString S, size_t pos, size_t len );
size_t KMP( SString *S, SString *T, size_t pos );
static void GetNext( SString *S, int *next );

typedef struct {
	char *chs;
	int length;
} HString;

BOOL InitHString( HString *T );
Status CreateHString( HString *T, const char *pstr, size_t length );
BOOL CmpHString( HString *S1, HString *S2 );
Status StrInsert( HString *S, int pos, HString T );
int kmp( const char *pSrc, int nSrcLength, const char *pSchema, int nSchemaLength, int pos );
#ifdef __cplusplus
}
#endif

#endif